/*
 * @Author: jiu yin
 * @Date: 2023-03-30 11:56:32
 * @LastEditTime: 2023-04-24 14:30:42
 * @LastEditors: jiu yin zhen jing
 * @FilePath: \admin\src\stores\user.js
 * jiu
 */
import { ref, computed, reactive, watchEffect } from 'vue'
import { defineStore } from 'pinia'
import {getSession,setSession} from "@/utils"

export const useCounterStore = defineStore('user', () => {
  const user = reactive(getSession('user')||{ name: "你说" })

  const doubleCount = computed(() => user)

  watchEffect(() => {
    setSession('user',doubleCount.value)
  })


  function increment(data) {
    return new Promise(async (resolve, reject) => {
      // let result= await  get_user_info(data)
      // user=result.data
      // resolve(result.data)
    })
  }

  return { user, doubleCount, increment }
})
